#define _CRT_SECURE_NO_WARNINGS 1
#include "BTTree.h"
BT* BuyNode(int x)
{
	BT* node = (BT*)malloc(sizeof(BT));
	if (node == NULL)
	{
		perror("malloc failed");
		exit(-1);
	}
	node->val = x;
	node->left = NULL;
	node->right = NULL;
}
void PreOrder(BT* root)
{
	if (root == NULL)
		return 0;
	printf("%d ", root->val);
	PreOrder(root->left);
	PreOrder(root->right);
}
void InOrder(BT* root)
{
	if (root == NULL)
		return 0;
	PreOrder(root->left);
	printf("%d ", root->val);
	PreOrder(root->right);
}
void BackOrder(BT* root) 
{
	if (root == NULL)
		return 0;
	PreOrder(root->left);
	PreOrder(root->right);
	printf("%d ", root->val);
}